﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DZPK
{
    public class Card
    {
        public Card(int card)
        {
            Color = (card - 1) >> 8;
            Value = card & 0xFF;
        }

        public Card(int color, int value)
        {
            Color = color;
            Value = value;
        }

        public int Color;
        public int Value;

        public string ToString()
        {
            string ret = string.Empty;

            string strColor = string.Empty;
            switch (Color)
            {
                case 1:
                    strColor = "黑桃";
                    break;
                case 2:
                    strColor = "梅花";
                    break;
                case 3:
                    strColor = "方块";
                    break;
                case 4:
                    strColor = "红桃";
                    break;
                default:
                    strColor = string.Format("{0}", Color);
                    break;
            }

            string strValue = string.Empty;
            switch (Value)
            {
                case 1:
                    strValue = "A";
                    break;
                case 2:
                    strValue = "2";
                    break;
                case 3:
                    strValue = "3";
                    break;
                case 4:
                    strValue = "4";
                    break;
                case 5:
                    strValue = "5";
                    break;
                case 6:
                    strValue = "6";
                    break;
                case 7:
                    strValue = "7";
                    break;
                case 8:
                    strValue = "8";
                    break;
                case 9:
                    strValue = "9"; 
                    break;
                case 10:
                    strValue = "10";
                    break;
                case 11:
                    strValue = "J";
                    break;
                case 12:
                    strValue = "Q";
                    break;
                case 13:
                    strValue = "K";
                    break;
                case 14:
                    strValue = "A";
                    break;
                default:
                    strValue = string.Format("{0}", Value);
                    break;
            }

            ret = string.Format("花色 ： {0}, 面值 ： {1}", strColor, strValue);

            return ret;
        }
    }
}
